<ion-view view-title="所有会员" id="vip-list" hide-nav-bar="true">
  <ion-header-bar align-title="center" class="bar-calm">
    <div class="buttons">
      <button class="button head-button button-clear center-btn" ng-click="goBack()">
        <img src="img/order-commit/backIcon.png">
      </button>
    </div>
    <h1 class="title">所有会员</h1>
      <div class="buttons" ng-if="!sendAllMessage">
          <button class="button head-button button-clear center-btn" ng-click="sendAll()">
              群发
          </button>
      </div>
  </ion-header-bar>
  <ion-content>
    <ion-refresher
            pulling-text="下拉刷新..."
            on-refresh="doRefresh()">
    </ion-refresher>
    <div class="bar bar-header item-input-inset">
        <label id="searchLabel" class="item-input-wrapper ">
            <i class="icon ion-ios-search placeholder-icon" style="font-size: 20px"></i>
            <input type="search" placeholder="请输入要查找的会员手机号" ng-model="input.phoneNumber" ng-change="goSearch()">
        </label>
        <button ng-hide="!input.phoneNumber" ng-click="clear()" class="wf-icon clean"></button>
        <!--<button class="button button-clear searchBar" ng-click="goSearch()">-->
            <!--搜索-->
        <!--</button>-->
    </div>

    <ion-list can-swipe="true" class="list-container" ng-if="vipList && vipList.length>0">
      <ion-item ng-repeat="item in vipList" ng-click="pick($index,$event,currentItem)">
        <div class="txt-container">
          <div class="vip-content">
            <div class="first-line">
              <div class="vip-name">{{item.username}}</div>
              <div class="select">
                <select ng-model="item.usertypeid" ng-options="itemType.typeid as itemType.typename for itemType in TypeList" ng-change="changeType(item)">
                </select>
              </div>
            </div>
            <div class="second-line">
              <span class="top-span">账户余额</span>
              <span class="down-span">{{item.account}} <span style="color:#828282;">元</span></span>
              <p ng-click="goAccount(item,$event)">增加</p>
            </div>
            <div class="third-line">
              <span class="top-span">信用额度</span>
              <span class="down-span">{{item.overdraft}} <span style="color:#828282;">元</span></span>
              <p ng-click="goReset(item,$event)">重置</p>
            </div>
          </div>
          <div class="vip-bottom">
            <div class="left-btn" on-tap="editRemark(item)">
              <div>{{item.remarks?item.remarks:'尚无备注'}}&nbsp;<span class="ion-edit"></span></div></div>
            <div class="right-btn" on-tap="sendMessage(item,$event)">
              <div><span class="send-message">发送消息</span></div>
            </div>
          </div>
          <!--<img ng-if="!sendAllMessage" ng-click="sendMessage(item,$event)" class="message" src="img/sendmessage.png"/>-->
        </div>
        <ion-option-button class="button-info button-positive" ng-click="revise($index,$event)">
          修改
        </ion-option-button>
        <ion-option-button class="button-info button-assertive" ng-click="remove($index,$event)">
          删除
        </ion-option-button>
      </ion-item>
    </ion-list>

    <!--<swipe-list items="vipList" item-click="pick" item-remove="remove" need-on-line="false" item-on-hold="sendMessage"-->
                <!--need-send-all="sendAllMessage" item-revise="revise" is-vip="true" item-increase="goAccount" item-reset="goReset"-->
                    <!--items-user-type-list="TypeList" item-type-change="changeType"></swipe-list>-->
    <div class="bottom-blank"></div>
    <ion-infinite-scroll
            ng-if="canLoadMore()"
            distance="1%"
            immediate-check=false
            on-infinite="loadMore()">
    </ion-infinite-scroll>
  </ion-content>
    <div class="foot-container" ng-if="sendAllMessage">
        <button type="button" class="button foot-button" ng-click="cancelOption()">
            取消
        </button>
        <button type="button" class="button foot-button" ng-click="confirmSend()">
            发送
        </button>
    </div>
</ion-view>
